﻿using System.Diagnostics;
using FreeSql;

namespace MachineVision.Shared.Services
{
    public class BaseService
    {
        static Lazy<IFreeSql> fsql = new Lazy<IFreeSql>(() =>
        {
            return new FreeSqlBuilder()
                .UseConnectionString(FreeSql.DataType.Sqlite, @"Data Source=MachineVision.db")
                .UseMonitorCommand(cmd => Trace.WriteLine($"Sql：{cmd.CommandText}"))
                .UseAutoSyncStructure(true) //自动同步实体结构到数据库，只有CRUD时才会生成表
                .Build();
        });
        public IFreeSql SqlLite => fsql.Value;
    }
}
